<html> 
<head> 
<title>Select Database</title> 
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
		<title>FossilPlot at Idaho State University</title>
		<meta name="keywords" content="Leif Tapanila, Fossil Plot, Fossilplot, FossilPlot, fossilplot, Sepkoski, compendium, diversity, paleontology, paleoecology, evolution, curve, geoscience, education, teaching">
		<meta name="description" content="FossilPlot at Idaho State University">
	
	
	<link rel="stylesheet" type="text/css" href="./styles1/basicFile.css">
<link rel="stylesheet" type="text/css" href="./styles1/tabber.css">
<script type="text/javascript" src="./js/tabber.js"></script>

<script type="text/javascript">
<!--
  // Tabber created by: Patrick Fitzgerald | http://www.barelyfitz.com
  document.write('<style type="text/css">.tabber{display:none;}<\/style>');
//-->
</script>
<script type="text/javascript">
<!--
/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Created by: Jerome Caron ::  */


function fillSelectFromArray(selectCtrl, itemArray, goodPrompt, badPrompt, defaultItem) {
var i, j;
var prompt;
// empty existing items
for (i = selectCtrl.options.length; i >= 0; i--) {
selectCtrl.options[i] = null;
}
prompt = (itemArray != null) ? goodPrompt : badPrompt;
if (prompt == null) {
j = 0;
}
else {
selectCtrl.options[0] = new Option(prompt);
j = 1;
}
if (itemArray != null) {
// add new items
for (i = 0; i < itemArray.length; i++) {
selectCtrl.options[j] = new Option(itemArray[i][0]);
if (itemArray[i][1] != null) {
selectCtrl.options[j].value = itemArray[i][1];
}
j++;
}
// select first item (prompt) for sub list
selectCtrl.options[0].selected = true;
   }
}
//-->
</script>

</head> 
<body background="ripple2.jpg"> 

<table width="611" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr> 
    <td height="95"><img src="FossilPlot-Banner.jpg" width="611" height="118" align="center"></td>
  </tr>
</table>
<table width="611" border="0" align="center">
  <tr> 
    <td width="118"> 
      <div align="left"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" width="117" height="25">
          <param name=movie value="button2.swf">
          <param name=quality value=high>
          <param name="BGCOLOR" value=""><param name="SCALE" value="noborder">
          <embed src="button2.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="117" height="25" bgcolor="" scale="noborder">
          </embed> 
        </object></div>
    </td>
    <td width="117"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" width="117" height="25">
        <param name=movie value="button3.swf">
        <param name=quality value=high>
        <param name="BGCOLOR" value=""><param name="SCALE" value="noborder">
        <embed src="button3.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="117" height="25" bgcolor="" scale="noborder">
        </embed> 
      </object></td>
    <td width="118"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" width="117" height="25">
        <param name=movie value="button4.swf">
        <param name=quality value=high>
        <param name="BGCOLOR" value=""><param name="SCALE" value="noborder">
        <embed src="button4.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="117" height="25" bgcolor="" scale="noborder">
        </embed> 
      </object></td>
    <td width="118"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" width="117" height="25">
        <param name=movie value="button5.swf">
        <param name=quality value=high>
        <param name="BGCOLOR" value=""><param name="SCALE" value="noborder">
        <embed src="button5.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="117" height="25" bgcolor="" scale="noborder">
        </embed> 
      </object></td>
    <td width="118"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" width="117" height="25">
        <param name=movie value="button1.swf">
        <param name=quality value=high>
        <param name="BGCOLOR" value=""><param name="SCALE" value="noborder">
        <embed src="button1.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="117" height="25" bgcolor="" scale="noborder">
        </embed> 
      </object></td>
  </tr>
</table>

<?php 

$debug= 0;
$vquery=$_POST['myquery']; 
$vquery=str_replace("\\", "", $vquery);

$username = "fossilplot";
$password = "fossilplot";
$hostname = "localhost"; 

//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
 or die("Unable to connect to MySQL");


//select a database to work with
$selected = mysql_select_db("fossilplot",$dbhandle)
  or die("Could not select examples");
if($debug){
print $vquery."<br>";
}
 $result = mysql_query($vquery)
 or die ("It is not an valid SQL query, please check your query and search again.");
 $page= (mysql_num_rows($result)/30)+1;
 
 echo "<center>";

 echo "<div class=\"tabber\" id=\"tab1\">";
 for($j=0;$j<$page; $j++){ 
 echo "<div class=\"tabbertab\" title=\"$j\">";
 echo "<table align=center>";
 echo "<tr>";
 echo "<td>Genus</td><td>ClassID</td><td>PhylumID</td><td>OrderID</td><td>Fad_Period</td><td>Fad_Stage</td><td>Fad_Date</td><td>Lad_Period</td><td>Fad_Stage</td><td>Lad_Date</td>";
 echo "</tr>";
 $k=0;
 
while ($k<30 && $row = mysql_fetch_array($result)) {
 print "<tr><td>".$row{'genus_name'}."</td><td>".$row{'class_id'}."</td><td>".$row{'phylum_id'}."</td><td>".$row{'order_id'}."</td><td>".$row{'fad_period'}."</td><td>".$row{'fad_stage'}."</td><td>".$row{'fad_date'}."</td><td>".$row{'lad_period'}."</td><td>".$row{'lad_stage'}."</td><td>".$row{'lad_date'}."</td></tr>";
 $k++;
}

echo "</table>";
echo "</div>";
}
echo "</div>";
echo "</center>";
mysql_close($dbhandle);

?>
</body> 
</html>